/*
 * InputStringQueryElement.java
 *
 * Created on September 8, 2007, 10:27 AM
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

package org.adl.registry.website.lucene;

import java.util.ArrayList;

/**
 *
 * @author Jacob
 */
public abstract class InputStringQueryElement
{
    private ArrayList<String> mElementParts;
    
    /** Creates a new instance of AnyTermQueryElement */
    public InputStringQueryElement()
    {
        this.mElementParts = new ArrayList<String>();
    }
    
    /** Creates a new instance of AnyTermQueryElement */
    public InputStringQueryElement(String value)
    {
        this();
        
        this.addInputValue(value);
    }
    
    public void addInputValue(String value)
    {
        //TODO: get default delimeter from properties file
        String delimeter = " ";
        
        String[] parts = value.split(delimeter);
        
        for (int i = 0; i < parts.length; i++)
        {
            String part = parts[i];
            
            this.mElementParts.add(part);
        }
    }
    
    protected ArrayList<String> getElementParts()
    {
        return this.mElementParts;
    }
}
